package com.wlps.result;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "分页返回值对象", description = "")
public class ResultPageVo <T>{
    @ApiModelProperty(value = "返回提示信息")
    private String msg ;
    @ApiModelProperty(value = "返回状态码")
    private Integer code;
    @ApiModelProperty(value = "放回每页的条数")
    private Long pageSize;
    @ApiModelProperty(value = "当前第几页")
    private  Long pageNum;
    @ApiModelProperty(value = "总条数")
     private  Long total;
    @ApiModelProperty(value = "总页数")
    private Long totalPage;
     @ApiModelProperty(value = "返回数据")
    private T data;

    public ResultPageVo(String msg, Integer code, Long pageSize, Long pageNum, Long total, T data) {
        this.msg = msg;
        this.code = code;
        this.pageSize = pageSize;
        this.pageNum = pageNum;
        this.total = total;
        this.data = data;
        this.totalPage=total % pageSize == 0 ? total / pageSize : total / pageSize + 1;
    }
}
